#!/usr/bin/python
# -*- coding: utf-8 -*-

# #列表推导式
# i = 0
# list1 = []
# while i<11:
#     list1.append(i)
#     i += 1
# print(list1)
#
# list2 = []
# for a in range(11):
#     list2.append(a)
# print(list2)
#
# #列表推导式
# list3 = [i for i in range(11)]
# print(list3)
#
#
# list4 = [i for i in range(0, 11, 2)]
# print(list4)
#
# list5 = [i for i in range(11) if i % 2 == 0]
# print(list5)

#字典推导式
# dict1 = {}
# for i in range(1, 6):
#     dict1[i] = i **2
# print(dict1)
#
# dict2 = {k:k ** 2 for k in range(1, 6)}
# print(dict2)


# list1 = ['name', 'age', 'gender']
# list2 = ['Tom', 20, 'man']
#
# dict1 = {list1[i]:list2[i] for i in range(len(list1))}
# print(dict1)


# counts = {'MBP': 268, 'HP': 125, 'DELL': 201, 'Lenovo': 199, 'acer': 99}
# dict1 = {}
# for k,v in counts.items():
#     if v> 200:
#         dict1[k] = v
# print(dict1)
#
#
# dict2 = {k:v for k,v in counts.items() if v > 200}
# print(dict2)


#集合推导式
# list1 = {1, 1, 2}
# set1 = {i**2 for i in list1}
# print(set1)


a = 'world'
print(id(a))
a = a.capitalize()
print(a)
print(id(a))


list1 = [1, 2, 3]
print(list1)
print(id(list1))
list1.append(4)
print(list1)
print(id(list1))
